using System;
using System.ComponentModel.Composition;

namespace EmraldClient
{
  [Export(typeof(IEmraldService))]
  [ExportMetadata("IsDebug", true)]
  public class EmraldServiceStub : IEmraldService
  {
    public string UserName
    {
      get { return "marhoily"; }
    }

    public bool Logon(string userName, string password)
    {
      Console.WriteLine("Logon");
//      Thread.Sleep(2000);
//      return userName == "valid";
      return true;
    }

    public Problem GetProblem()
    {
//      throw new Exception("Mamma mia!");
//      Thread.Sleep(5000);
// new Problem("r3r1k1/2p2ppp/p4b2/1pP2R1N/8/2P2Q1P/P1p2PPK/R1Bq4 b KQkq - 0 1", "f6-e5", "f5-e5", "d1-f3", "e5-e8", "a8-e8", "g2-f3") Nh5-a8!?
      return new Problem("8/6p1/1P4k1/5pP1/5P2/3p1q1p/3Q3K/8 b KQkq - 0 1", "f3-e2", "d2-e2", "d3-e2", "b6-b7", "e2-e1", "b7-b8")
            {
                 Ex = TimeSpan.FromSeconds(3.4),
                 Fail = -2.2,
                 Succ = 26,
                 IsReversed = false,
                 Id = "p1623",
                 PosRD = 66,
                 TacRD = 34,
                 PosRating = 1200,
                 TacRating = 1300,
               };
    }

    public void Logout()
    {
//      Thread.Sleep(2000);
      Console.WriteLine("Logout");
    }

    public void SendResults(Problem problem)
    {
//      Thread.Sleep(2000);
      Console.WriteLine("Send results for problem #" + problem.Id);
    }
  }
}